#ifndef CHAT_H
#define CHAT_H

#include <QDialog>
#include <QTcpServer>
#include <QTcpSocket>
#include <QMessageBox>
#include <QFileDialog> // 文件对话框
#include <QListWidget>
#include <QListWidget>
#include "addfriend.h"
#include "userinfo.h"
#include "acceptrequest.h"
#include "chatframe.h"


namespace Ui {
class chat;
}

class Chat : public QDialog
{
    Q_OBJECT

public:
    explicit Chat(QTcpSocket *s,QWidget *parent = 0);
    ~Chat();
    void setInfo(QString name);
    void getFriendList();


private:
    Ui::chat *ui;
    QTcpSocket * socket = NULL;
    QString username;
    ChatFrame * chatframe = NULL;
    QListWidget * widget = NULL;
    QByteArray msg_buffer;
    ChatPackage * cpack = NULL;
    AddFriend * adf = NULL;
    QListWidgetItem * item ;
    AcceptRequest * areq = NULL;
    int flag_bak = 0;
private slots:
    void DealreqAnswer();
    void clickEvent();
    void ChatToSomebody(QListWidgetItem *item);
    void AddFriendSlot();
};

#endif // CHAT_H
